package com.kly.chatter.db.dao.impl;

import com.fqgj.common.base.AbstractBaseMapper;
import com.google.common.collect.Maps;
import com.kly.chatter.db.dao.ChatterDashboardInfoDao;
import com.kly.chatter.db.entity.ChatterDashboardInfoEntity;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.HashMap;

/**
 * User: a
 * Date: 2023-10-07
 * Time: 15:45:34.877
 */

@Repository
public class ChatterDashboardInfoDaoImpl extends AbstractBaseMapper<ChatterDashboardInfoEntity> implements ChatterDashboardInfoDao {

    @Override
    public ChatterDashboardInfoEntity getDashboardInfo(String userCode,Integer currentDate) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("chatterCode", userCode);
        params.put("onDate", currentDate);
        return this.getSqlSession().selectOne(this.getStatement("getDashboardInfo"), params);
    }

    @Override
    public ChatterDashboardInfoEntity getWeekDashboardInfo(String userCode, Integer startDate, Integer endDate) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("chatterCode", userCode);
        params.put("startDate", startDate);
        params.put("endDate", endDate);
        return this.getSqlSession().selectOne(this.getStatement("getWeekDashboardInfo"), params);
    }

    @Override
    public Integer getPPVCount(String userCode, Integer currentDate) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("chatterCode", userCode);
        params.put("onDate", currentDate);
        return this.getSqlSession().selectOne(this.getStatement("getPPVCount"), params);
    }
}